<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://oss.petslib.cn/prod/static/cdns/pdfjs-dist/legacy-2.12.313/build/pdf.js"></script>
    <script>
        pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://oss.petslib.cn/prod/static/cdns/pdfjs-dist/legacy-2.12.313/build/pdf.worker.js'
    </script>
    <script>
        // Setting up fake worker failed: "Cannot read property 'WorkerMessageHandler' of undefined".

        const search = new URLSearchParams(location.search)
        const url = search.get('file')
        const loadingTask = pdfjsLib.getDocument({
            url,
            cMapUrl: '/pdfviewer/pdfjs-2.12.313-legacy-dist/web/cmaps/',
            cMapPacked: true,
        })
        loadingTask.promise.then((pdf) => {
            console.log(pdf)
          alert('pdf ok')
        }).catch(err => {
          alert('111' + err.message)
        })
    </script>
</head>

<body>

</body>

</html>